<?php
//1. 跨域设置
header("access-control-allow-origin:*");
//2. 包含文件
include_once("./utils/db.php");
include_once("./utils/functions.php");

$sql = "select * from xk_course";

$courses = [];
$results = mysqli_query($conn, $sql);

while ($row = mysqli_fetch_assoc($results)) {
  $courses[] = $row;
}

//4. 输出位json数据
echo json_encode($courses, JSON_UNESCAPED_UNICODE);
